package Projectiles;

import java.awt.Graphics;
import java.util.ArrayList;

import Main.SpaceGame;

public class ProjectileManager 
{
	public ArrayList<Projectile> projectileList = new ArrayList<Projectile>();
	private SpaceGame main;
	
	public ProjectileManager(SpaceGame main)
	{
		this.main = main;
		/**
		projectileList.add(new Torpedo(0, 0, 2, 2, main, false));
		projectileList.add(new Torpedo(100, 0, 2, 2, main, false));
		projectileList.add(new Torpedo(100, 80, 2, 2, main, false));
		projectileList.add(new Torpedo(800, 20, -2, 2, main, false));
		projectileList.add(new Torpedo(0, 100, 2, 2, main, false));
		**/
		
	}
	
	public void update()
	{
		for(int i = 0;i<projectileList.size();i++)
		{
			projectileList.get(i).update();
		}
	}
	
	public void draw(Graphics g)
	{
		for(int i = 0;i<projectileList.size();i++)
		{
			if(projectileList.get(i).x >= main.camera.getPixelX()-10 && projectileList.get(i).y <= main.camera.getPixelX()+SpaceGame.windowXSize-190 && ( projectileList.get(i).y >= main.camera.getPixelY() && projectileList.get(i).y <= main.camera.getPixelY()+SpaceGame.windowYSize+10))
			{
				projectileList.get(i).draw(g);
			}
		}
	}
}
